<script>
$(document).ready(function(){
	
	var c = {
		submitok:function(){
			var da = js.getformdata('myform{rand}');
			if(!da.mobile || !da.yzm){js.msg('msg','请输入信息');return}
			js.ajax.get({
				url:'api/geren/editmobile',
				loading:'修改中...',
				loadsuccess:'修改成功',
				data:da
			},function(){
				$('span[show=mobile]').html(js.check.mobilexing(da.mobile));
				js.tanclose('edphoneshow');
			});
		},
		getcode:function(o){
			var da = js.getformdata('myform{rand}');
			var sj = da.mobile;
			if(!sj || !js.check.iscnmobile(sj)){js.msg('msg','请输入正确手机号');return}
			o.innerHTML='获取中';
			o.disabled=true;
			js.ajax.get({
				url:'api/geren/getcode',
				data:{
					mobile:sj
				},
				onerror:function(){
					o.innerHTML='获取';
					o.disabled=false;
				}
			},function(ret){
				js.msg('success','验证码已发送')
				c.daojishi(o,60);
			});
		},
		daojishi:function(o,sj){
			if(sj==0){
				o.innerHTML='重新获取';
				o.disabled = false;
				return;
			}
			o.innerHTML=''+sj+'';
			setTimeout(function(){
				c.daojishi(o, sj-1);
			},1000);
		}
	}
	js.initbtn(c,'mainmobile{rand}');
});
</script>

<div style="padding:10px 20px" id="mainmobile{rand}">
	<form name="myform{rand}" autocomplete="off">
	<div>
		<div style="display:flex"><input style="flex:1" maxlength="20" value="" class="input" name="mobile" placeholder="输入新的手机号"></div>
	</div>
	<div class="blank10"></div>
	<div>
		<div style="display:flex">
		<input style="flex:1;border-radius:5px 0px 0px 5px" maxlength="6" name="yzm" class="input" placeholder="手机验证码">
		<button type="button" clickevt="getcode" style="border-radius:0px 5px 5px 0px;border-left-width:0px" class="webbtn webbtn-default">获取</button>
		</div>
	</div>
	
	</form>
	<div style="margin-top:30px" align="center"><button clickevt="submitok" style="width:150px" type="button" class="webbtn webbtn-big">修改</button></div>
</div>